package 线程组;

public class TGroup implements Runnable{


    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() +" 在 "+ Thread.currentThread().getThreadGroup().getName());
    }

    public static void main(String[] args) {
        TGroup tGroup = new TGroup();
        ThreadGroup group1 = new ThreadGroup("测试组");
        ThreadGroup group2 = new ThreadGroup("2号测试组");

        Thread t1 = new Thread(group1,tGroup,"t1");
        Thread t2 = new Thread(group2,tGroup,"t2");
        Thread t3 = new Thread(group2,tGroup,"t3");

        t1.start();
        t2.start();
        t3.start();
    }
    //t1 在 测试组
    //t2 在 2号测试组
    //t3 在 2号测试组
}
